<template>
  <div class="" style="height: 100%">
    <beijingdatatable :header="header" :datalist="datalist" />
  </div>
</template>
<script>
import data from "../data";

export default {
  name: "datatablewarnbeijing",
  components: {},
  data() {
    return {
      header: [],
      datalist: [],
    };
  },
  computed: {},
  watch: {
    "$store.state.daping.datatablewarnbeijing": {
      handler: function (n, o) {
        this.loadData(n);
      },
    },
  },
  mounted() {},
  methods: {
    loadData(n) {

/*******************************
 * 
 * 
 * 
 * bound: 0
code: "001-000-001-007-005-0069"
id: 1
levelColor: "#CBCBCB"
levelId: 4
levelName: "普通"
name: "忆江南小区站"
objType: "热力站"
oriLevelId: 4
oriLevelName: "普通"
params: null
pid: "29593"
remark: "一级网回水温度测量值"
repeatCnt: 242
riseTime: "2020-09-03T08:43:47+08:00"
status: 0
updateTime: "2020-09-09 22:47:01"
value: 27.91
warnValue: 50
 * 
 */


      this.header = data.header2;
      let aaa = [];
      n.map(item =>{
        aaa.push([
          item['name'],
          item['remark'] + (item['warnValue'] > item['value'] ? '过高' : '过低'),
          item['warnValue'],
          `<span style="background-color: ${item['levelColor']}">` + item['levelName'] + '</span>',
          item['riseTime'],
        ]);
      })
      // for (let index = 0; index < n.length; index++) {
      //   let item = n[index]
      // }
      this.datalist = aaa;
    },
  },
};
</script>
<style lang='scss' scoped>
</style>